export default {
  namespaced: true,
  state: {
    taskList: [],
    state: '0',
    isShow: false,
  },
  mutations: {
    addTask(state, task) {
      state.taskList.unshift({
        taskName: task,
        state: false,
      })
    },
    setTaskState(state, taskId) {
      state.taskList[taskId].state = !state.taskList[taskId].state
    },
    delTask(state, taskId) {
      state.taskList.splice( taskId, 1)
    },
    delCompleteTask(state) {
      state.taskList = state.taskList.filter( item=> !item.state )
    },
    setState(state, val) {
      state.state = val
    },
    setIsShow(state) {
      state.isShow = !state.isShow
      state.taskList.forEach(item=> item.state = state.isShow)
    }
  },
  actions: {}
}